﻿<UserControl x:Class="EasyToolkit.Excel.UI.SortAndFilter.FilterOnValue"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
>

    <UserControl.Resources>
        <ResourceDictionary>
            <BooleanToVisibilityConverter x:Key="BoolToVis" />
            <sys:Double x:Key="ButtonSize">25</sys:Double>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/EasyToolkit;component/UI/Resources/Icons.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    
    <!--<ToggleButton IsChecked="{Binding IsNoCaseSensitive}" Width="20" Height="20" ToolTip="No Case Sensitive" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,3,0">
        <Path Stretch="Fill" DataContext="{StaticResource icon_CapitalLetters}" Data="{Binding Path=Data}" Fill="{DynamicResource HighlightBrush}" />
    </ToggleButton>-->
    
    <GroupBox Header="Filter On Values" Margin="5">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
                <RowDefinition />
            </Grid.RowDefinitions>

            <StackPanel Grid.Row="0" Orientation="Horizontal">
                <Button Grid.Column="0" Margin="5" Command="{Binding FilterSelectAllCommand}" Width="{StaticResource ButtonSize}" Height="{StaticResource ButtonSize}" ToolTip="Select All" HorizontalAlignment="Center" VerticalAlignment="Center">
                    <Path Stretch="Fill" DataContext="{StaticResource icon_FilterSelectAll}" Data="{Binding Path=Data}" Fill="{DynamicResource HighlightBrush}" />
                </Button>
                <Button Grid.Column="1" Margin="5" Command="{Binding FilterUnSelectAllCommand}"  Width="{StaticResource ButtonSize}" Height="{StaticResource ButtonSize}" ToolTip="UnSelectAll" HorizontalAlignment="Center" VerticalAlignment="Center">
                    <Path Stretch="Fill" DataContext="{StaticResource icon_FilterUnSelectAll}" Data="{Binding Path=Data}" Fill="{DynamicResource HighlightBrush}" />
                </Button>
            </StackPanel>

            <Border Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="1" BorderThickness="1" BorderBrush="{DynamicResource HighlightBrush}">
                <Grid DataContext="{Binding SelectedDefinition}" Margin="4,0,0,0" >
                    <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
                        <ItemsControl ItemsSource="{Binding ValueSelectionList}">
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <CheckBox IsChecked="{Binding IsSelected}">
                                        <Label Content="{Binding ValueString}"/>
                                    </CheckBox>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>
                    </ScrollViewer>
                </Grid>
            </Border>
        </Grid>
    </GroupBox>
</UserControl>
